<?php echo $this->render('/public/header');?>
<?php use yii\helpers\Url;?>
<div id="main" class="col-xs-12">
	<div id="tablelist" style="height:400px"></div>
	<div><button class="btn btn-primary" onclick="get_table_data()">提交</button></div>
</div>
<script>
	var data = [
	['', '', '', '', '', ''],
	['', '', '', '', '', ''],
	['', '', '', '', '', ''],
	['', '', '', '', '', ''],
	['', '', '', '', '', '']
	],
	container = document.getElementById('tablelist');

	hot = new Handsontable(container, {
		data: data,
		height:"400px",
		minSpareRows: 1,
		colHeaders:[
		'日期','工厂','产品','退还金额','退税率','是否已收工厂发票'
		],
		dropdownMenu: true,
		contextMenu: true,
		stretchH: 'all',
		columns: [
		{

			type: 'date',
			dateFormat: 'YYYY-MM-DD',
			correctFormat: true,
			defaultDate: (new Date().getYear())
		},
		{
			//data:"in_money"
		},
		{
			//data:"out_money"
		},
		{
			//data:"remain_money"
			type:"numeric",
			format:"0.00"
		},
		{
			type:"numeric",
			format:"0.00"
		},
		{
			editor:"select",
			selectOptions: {"0":'否', "1":'是'}
		}

		]

	});
</script>
<script>
	function get_table_data()
	{
		if(layer.confirm('确认上传',{},function(){
			layer.load(0, {shade: false});
			var url = "<?php echo Url::to(['finance/rebate_upload']);?>";
			$.post(url,{data:data},function(res){
				layer.closeAll('loading');
				if(res.code==1)
				{
					layer.confirm(res.msg,{},function(){
						window.location.reload();
					})
				}
				else
				{
					layer.alert(res.msg);
				}
			})
		}));
	}
</script>
<?php echo $this->render('/public/footer');?>